home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
10,000 Great Games
/
10,000 Great Games.iso
/
Product
/
66
/
data1.cab
/
Source_Files
/
Src
/
Error.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
2000-01-16
|
1KB
|
67 lines
#include "stdafx.h"
#include <stdarg.h>
void info(char *msg, ...)
{
va_list arg;
char m[256];
va_start(arg, msg);
vsprintf(m, msg, arg);
if (!inawin && DD != 0)
DD->FlipToGDISurface();
AfxMessageBox(m, MB_OK | MB_ICONINFORMATION | MB_APPLMODAL);
}
void warning(char *msg, ...)
{
va_list arg;
char m[256];
va_start(arg, msg);
vsprintf(m, msg, arg);
if (!inawin && DD != 0)
DD->FlipToGDISurface();
AfxMessageBox(m, MB_OK | MB_ICONEXCLAMATION | MB_APPLMODAL);
}
void error(char *msg, ...)
{
// Mechanism to prevent errors in error routine
static int error_depth = 0;
error_depth++;
if (error_depth > 1)
exit(1);
// Translate the message
va_list arg;
char m[256];
va_start(arg, msg);
vsprintf(m, msg, arg);
// Free some game resources for cleaner exit
deinit_game();
// Release clip (if any)
ClipCursor(0);
// Show box
AfxMessageBox(m, MB_OK | MB_ICONERROR | MB_APPLMODAL);
// Exit
exit(1);
}